//
//  PlatformCell.m
//  WorkNest
//
//  Created by qbm360 on 15/7/20.
//  Copyright (c) 2015年 nest. All rights reserved.
//

#import "PlatformCell.h"
#import <SDCycleScrollView/SDCycleScrollView.h>

@interface PlatformCell ()

@property (weak, nonatomic) IBOutlet SDCycleScrollView *cycleScrollView;
@property (weak, nonatomic) IBOutlet UIButton *contact;
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UILabel *productNumber;
@property (weak, nonatomic) IBOutlet UILabel *productDiscription;
@property (weak, nonatomic) IBOutlet UILabel *wholesaleCount;   // 起批数量
@property (weak, nonatomic) IBOutlet UILabel *wholesalePrice;
@property (weak, nonatomic) IBOutlet UILabel *discountCount;
@property (weak, nonatomic) IBOutlet UILabel *discountPrice;
@property (weak, nonatomic) IBOutlet UILabel *sellCount;
@property (weak, nonatomic) IBOutlet UILabel *clothesNumber;
@property (weak, nonatomic) IBOutlet UILabel *percentage;

@end

@implementation PlatformCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

- (IBAction)phoneButton:(id)sender {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://0571-86700832"]];
}

- (void)setModel:(ProductDetailModel *)model {
    _model = model;
    self.name.text = _model.productName;
    NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:_model.imageList.count];
    for (int i=0; i<_model.imageList.count; i++) {
        [array addObject:[UIUtil containString:_model.imageList[i]]];
    }
    self.cycleScrollView.imageURLStringsGroup = array;
    self.productNumber.text = [NSString stringWithFormat:@"产品编码:%@",_model.productId];
    self.productDiscription.text = _model.productDescription;
    self.wholesaleCount.text = [NSString stringWithFormat:@"%@ 起批",_model.minOrderNumber];
    self.wholesalePrice.text = [NSString stringWithFormat:@"￥%@",_model.quotation];
    self.discountCount.text = [NSString stringWithFormat:@"≥%@件",_model.optOrderNumber];
    self.discountPrice.text = [NSString stringWithFormat:@"￥%@",_model.quotation2];
    self.sellCount.text = [NSString stringWithFormat:@"热销%@件",_model.bookedQuantity];
    self.clothesNumber.text = [NSString stringWithFormat:@"样衣编码:%@",_model.splId];
    if (_ifMyProduct) {
        self.percentage.text = [NSString stringWithFormat:@"佣金比例:%@",_model.percentage];
    }
}

@end
